package com.jiandan.business.web;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jiandan.base.entity.ExtData;
import com.jiandan.base.mapper.JsonMapper;
import com.jiandan.base.utils.ExtDataUtil;
import com.jiandan.business.service.CemeteryAreaService;
import com.jiandan.business.service.CemeteryService;
import com.jiandan.business.vo.CemeteryAreaVo;
import com.jiandan.business.vo.CemeteryVo;

@Controller
@RequestMapping(value = "/cemetery")
public class CemeteryController {
	
private static Logger logger = Logger.getLogger(CemeteryController.class);
	
	@Autowired
	private CemeteryService cemeteryService;
	
	
	/** 
	 * 获取墓区信息.
	 *
	 * @param areaId the area id
	 * @return the area detail info
	 */
	@RequestMapping(value = "findCemeteryInfo")
	@ResponseBody
	public Object findCemeteryInfo(HttpServletRequest request, Long cemeteryId){
		CemeteryVo vo = cemeteryService.findCemeteryInfo(cemeteryId);
		ExtData<CemeteryVo> extData = ExtDataUtil.genWithSingleData(vo);
		String resData = JsonMapper.nonEmptyMapper().toJsonP(request.getParameter("callback"), extData);
		logger.info("获取墓区返回的JSON字符串:" + resData);
		return resData;
	}
	

}
